<template>
  <button type="primary" @click="login">登录</button>
  <button type="warn" @click="sendCode">获取验证码</button>
  <view>
    <button @click="store.addCount">+</button>
    <text>{{ store.count }}</text>
    <button @click="store.cutCount">-</button>
  </view>
</template>

<script setup lang="ts">
  import { loginAPI, sendCodeAPI } from '@/api'
  import { SendCode } from '@/types/enum'
  import { useCounter } from '@/store/counter'
  import { onMounted } from 'vue'
  import RequestHttp from '@/utils/request'
  import { HttpUrlVariable } from '@/constants'

  const store = useCounter()

  const login = async () => {
    const res = await loginAPI({ mobile: '13230000001', password: 'abc12345' })
    uni.showToast({
      title: res.token,
      icon: 'none',
    })
  }
  const sendCode = async () => {
    const res = await sendCodeAPI({
      mobile: '13230000001',
      type: SendCode.BINDMOBILE,
    })
    uni.showToast({
      title: res.code,
      icon: 'none',
    })
  }
</script>

<style lang="scss"></style>
